package com.qq.business.impl;

import com.qq.anonatation.LogAnotation;
import com.qq.anonatation.Transaction;
import com.qq.business.OrderService;
import org.springframework.stereotype.Component;

@Component
public class OrderServiceImpl implements OrderService {
    @Override
    @Transaction(rollbackFor = Exception.class)
    public void generate() throws Exception {

        Thread.sleep(1234);
        System.out.println("订单已⽣成");
        throw new Exception();

    }

    @Override
    @LogAnotation("detail")
    public void detail() {
        try {
            Thread.sleep(2541);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("订单信息如下：******");
    }

    @Override
    @LogAnotation
    public void modify() {
        try {
            Thread.sleep(1010);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("订单已修改");
    }

    @Override
    public void delete() {
        try {
            Thread.sleep(1010);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("订单已删除");
    }
}